package monster.com.cvh.adapter;

import android.content.Intent;
import android.support.annotation.Nullable;
import android.view.View;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import monster.com.cvh.R;
import monster.com.cvh.activity.PhotoActivity;
import monster.com.cvh.bean.ResumeShopBean;
import monster.com.cvh.constant.Constans;
import monster.com.cvh.view.ResumeImageView;

/**
 * @author: 13580
 * @data: 2018/4/11
 * @function:简历模板商城item
 */
public class ResumeShopAdapter extends BaseQuickAdapter<ResumeShopBean.DataBean, BaseViewHolder> {

    public ResumeShopAdapter(@Nullable List<ResumeShopBean.DataBean> data) {
        super(R.layout.item_resuem_shop, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, final ResumeShopBean.DataBean item) {
        ResumeImageView resumeImageView = (ResumeImageView) helper.getView(R.id.iv_item_resume_shop);
        resumeImageView.setmHasLock(item.isIs_locked());
        Glide.with(mContext).load(item.getCover_image_url())
                .thumbnail(0.1f)
                .crossFade()
                .diskCacheStrategy(DiskCacheStrategy.RESULT)
                .into(resumeImageView);
        helper.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, PhotoActivity.class);
                intent.putExtra(Constans.RESUME_INFO_BEAN,item);
                mContext.startActivity(intent);
            }
        });
    }
}
